%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/v4/large_bigint.issue491"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 9, 10, 35, 50, 51, 11, 15, 16, 24, 25<br />2: PgSelect[8], PgSelect[18], PgSelect[27]<br />3: 12, 21, 30<br />ᐳ: 20, 22, 29, 31<br />4: ConnectionItems[32]"):::bucket
    Bucket1("Bucket 1 (nullableBoundary)<br />Deps: 12, 32, 35<br /><br />ROOT Connectionᐸ8ᐳ[12]"):::bucket
    Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 22, 35<br /><br />ROOT PgSelectSingleᐸlarge_node_idᐳ[22]"):::bucket
    Bucket3("Bucket 3 (nullableBoundary)<br />Deps: 31, 35<br /><br />ROOT PgSelectSingleᐸlarge_node_idᐳ[31]"):::bucket
    Bucket5("Bucket 5 (listItem)<br />Deps: 35<br /><br />ROOT __Item{5}ᐸ32ᐳ[44]"):::bucket
    Bucket6("Bucket 6 (nullableBoundary)<br />Deps: 45, 35<br /><br />ROOT PgSelectSingle{5}ᐸlarge_node_idᐳ[45]"):::bucket
    end
    Bucket0 --> Bucket1 & Bucket2 & Bucket3
    Bucket1 --> Bucket5
    Bucket5 --> Bucket6

    %% plan dependencies
    Object11{{"Object[11∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    Access9{{"Access[9∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access10{{"Access[10∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access9 & Access10 --> Object11
    PgSelect18[["PgSelect[18∈0] ➊<br />ᐸlarge_node_idᐳ"]]:::plan
    Access16{{"Access[16∈0] ➊<br />ᐸ15.1ᐳ"}}:::plan
    Access16 -->|rejectNull| PgSelect18
    Object11 --> PgSelect18
    PgSelect27[["PgSelect[27∈0] ➊<br />ᐸlarge_node_idᐳ"]]:::plan
    Access25{{"Access[25∈0] ➊<br />ᐸ24.1ᐳ"}}:::plan
    Access25 -->|rejectNull| PgSelect27
    Object11 --> PgSelect27
    PgSelect8[["PgSelect[8∈0] ➊<br />ᐸlarge_node_idᐳ"]]:::plan
    Object11 --> PgSelect8
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access9
    __Value2 --> Access10
    Connection12[["Connection[12∈0] ➊<br />ᐸ8ᐳ"]]:::plan
    PgSelect8 --> Connection12
    Lambda15{{"Lambda[15∈0] ➊<br />ᐸspecifier_LargeNodeId_base64JSONᐳ<br />More deps:<br />- Constantᐸ'WyJsYXJnZV9ub2RlX2lkcyIsOTAwNzE5OTI1NDc0MDk5MF0='ᐳ[50]"}}:::plan
    Lambda15 --> Access16
    First20{{"First[20∈0] ➊"}}:::plan
    PgSelectRows21[["PgSelectRows[21∈0] ➊"]]:::plan
    PgSelectRows21 --> First20
    PgSelect18 --> PgSelectRows21
    PgSelectSingle22{{"PgSelectSingle[22∈0] ➊<br />ᐸlarge_node_idᐳ"}}:::plan
    First20 --> PgSelectSingle22
    Lambda24{{"Lambda[24∈0] ➊<br />ᐸspecifier_LargeNodeId_base64JSONᐳ<br />More deps:<br />- Constantᐸ'WyJsYXJnZV9ub2RlX2lkcyIsIjIwOTgyODg2NjkyMTg1NzE3NjAiXQ=='ᐳ[51]"}}:::plan
    Lambda24 --> Access25
    First29{{"First[29∈0] ➊"}}:::plan
    PgSelectRows30[["PgSelectRows[30∈0] ➊"]]:::plan
    PgSelectRows30 --> First29
    PgSelect27 --> PgSelectRows30
    PgSelectSingle31{{"PgSelectSingle[31∈0] ➊<br />ᐸlarge_node_idᐳ"}}:::plan
    First29 --> PgSelectSingle31
    ConnectionItems32[["ConnectionItems[32∈0] ➊"]]:::plan
    Connection12 --> ConnectionItems32
    List37{{"List[37∈2] ➊<br />ᐸ35,36ᐳ<br />More deps:<br />- Constantᐸ'large_node_ids'ᐳ[35]"}}:::plan
    PgClassExpression36{{"PgClassExpression[36∈2] ➊<br />ᐸ__large_node_id__.”id”ᐳ"}}:::plan
    PgClassExpression36 --> List37
    PgSelectSingle22 --> PgClassExpression36
    Lambda38{{"Lambda[38∈2] ➊<br />ᐸbase64JSONEncodeᐳ"}}:::plan
    List37 --> Lambda38
    PgClassExpression42{{"PgClassExpression[42∈2] ➊<br />ᐸ__large_no...d__.”text”ᐳ"}}:::plan
    PgSelectSingle22 --> PgClassExpression42
    List40{{"List[40∈3] ➊<br />ᐸ35,39ᐳ<br />More deps:<br />- Constantᐸ'large_node_ids'ᐳ[35]"}}:::plan
    PgClassExpression39{{"PgClassExpression[39∈3] ➊<br />ᐸ__large_node_id__.”id”ᐳ"}}:::plan
    PgClassExpression39 --> List40
    PgSelectSingle31 --> PgClassExpression39
    Lambda41{{"Lambda[41∈3] ➊<br />ᐸbase64JSONEncodeᐳ"}}:::plan
    List40 --> Lambda41
    PgClassExpression43{{"PgClassExpression[43∈3] ➊<br />ᐸ__large_no...d__.”text”ᐳ"}}:::plan
    PgSelectSingle31 --> PgClassExpression43
    __Item44[/"__Item[44∈5]<br />ᐸ32ᐳ"\]:::itemplan
    ConnectionItems32 ==> __Item44
    PgSelectSingle45{{"PgSelectSingle[45∈5]<br />ᐸlarge_node_idᐳ"}}:::plan
    __Item44 --> PgSelectSingle45
    List47{{"List[47∈6]<br />ᐸ35,46ᐳ<br />More deps:<br />- Constantᐸ'large_node_ids'ᐳ[35]"}}:::plan
    PgClassExpression46{{"PgClassExpression[46∈6]<br />ᐸ__large_node_id__.”id”ᐳ"}}:::plan
    PgClassExpression46 --> List47
    PgSelectSingle45 --> PgClassExpression46
    Lambda48{{"Lambda[48∈6]<br />ᐸbase64JSONEncodeᐳ"}}:::plan
    List47 --> Lambda48
    PgClassExpression49{{"PgClassExpression[49∈6]<br />ᐸ__large_no...d__.”text”ᐳ"}}:::plan
    PgSelectSingle45 --> PgClassExpression49

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect8,Access9,Access10,Object11,Connection12,Lambda15,Access16,PgSelect18,First20,PgSelectRows21,PgSelectSingle22,Lambda24,Access25,PgSelect27,First29,PgSelectRows30,PgSelectSingle31,ConnectionItems32 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,PgClassExpression36,List37,Lambda38,PgClassExpression42 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,PgClassExpression39,List40,Lambda41,PgClassExpression43 bucket3
    classDef bucket5 stroke:#7fff00
    class Bucket5,__Item44,PgSelectSingle45 bucket5
    classDef bucket6 stroke:#ff1493
    class Bucket6,PgClassExpression46,List47,Lambda48,PgClassExpression49 bucket6

